 <!-- DANG NHAP -->



    <ul class="breadcrumb">
          	<li><a href="<?php echo HOME; ?>"><i class="fa fa-home"></i> Home</a></li>
            <li><a href="<?php echo url(); ?>">Thông Tin Cá Nhân</a></li>
 
          </ul>
          
          <?php
if(!isset($_SESSION['user'])){
die();
}

require("public/exts/xcrud/xcrud.php");


  		$xcrud = Xcrud::get_instance();
        $xcrud->table('users');
		
		
		
		$xcrud->where("id=".$_SESSION['user']['id']);
		$xcrud->relation('group_id','user_group','id','name');
		$xcrud->columns("username,name,email,group_id,avatar,slogan,facebook_url");
		$xcrud->change_type('avatar', 'remote_image');
        $xcrud->fields('username,name,email,slogan,facebook_url,image', false, 'Thông Tin Cá Nhân');
		$xcrud->fields('chuky', false, 'Chữ Ký');
		
		$xcrud->change_type('image','image','',array("path"=>"../../../images/user",'width'=>100,'height'=>'100','crop'=>true)); 
		$xcrud->label(array("image"=>"Upload New Avatar"));
       
	
		$xcrud->label(array("slogan"=>"Status","facebook_url"=>"Facebook Link","group_id"=>"Group","chuky"=>"Chữ Ký"));
		$xcrud->change_type("chuky","texteditor");
		
		$xcrud->set_attr('name',array("placeholder"=>"Bạn chỉ được cập nhật Name 1 lần duy nhất"));
		
	
		 if($_SESSION['user']['username']!='undefined' && $_SESSION['user']['username']!='' ){
			 $xcrud->disabled("username"); 
		}
		if($_SESSION['user']['email']!='undefined'){
			 $xcrud->disabled("email"); 
		}
		if($_SESSION['user']['changename']==0&&$_SESSION['user']['name']!=''){
			 $xcrud->disabled("name"); 
		}
	
	
		$xcrud->before_update("user_before_update","user.php");
		$xcrud->after_update("user_after_update","user.php");
		
         
		
		$xcrud->hide_button('save_edit');   
		$xcrud->show_primary_ai_column(true);
		$xcrud->unset_remove();
		$xcrud->unset_add();		 
        $xcrud->unset_csv();
		$xcrud->unset_print();
		$xcrud->unset_title();
		$xcrud->unset_limitlist();
		$xcrud->unset_search();
		
		
		if($_SESSION['edit_userinfor']==1){
			echo $xcrud->render('edit',$_SESSION['user']['id']); // edit entry screen, '12' - primary key
		}else{
		   echo $xcrud->render();
		}
